<template>
  <BasicDrawer v-bind="$attrs" @register="registerDrawer" title="移动端菜单详情" width="600px">
    <Description :column="1" :data="detailData" @register="registerDescription" />
  </BasicDrawer>
</template>
<script lang="ts" setup>
  import { ref, useAttrs } from "vue"
  import { BasicDrawer, useDrawerInner } from "/@/components/Drawer"
  import { formDetailSchema } from "./data"
  import { Description, useDescription } from "/@/components/Description/index"
  import { getMobileMenu } from "/@/api/sys/mobileMenu"
  const emit = defineEmits(["register"])
  const attrs = useAttrs()
  const detailData = ref({})
  const [registerDescription] = useDescription({
    schema: formDetailSchema,
    labelStyle: {
      marginLeft: "10px",
      width: "100px",
    },
  })

  const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
    setDrawerProps({ confirmLoading: false, loading: true })
    try {
      detailData.value = await getMobileMenu({ id: data.record.id })
    } finally {
      setDrawerProps({ loading: false })
    }
  })
</script>
